package com.fubt.repeat.exception;

import java.util.HashMap;
import java.util.Map;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;

import com.fubt.repeat.RepeatException;

@ControllerAdvice
@ResponseBody
public class ExceptionAdvice {

    /**
     * 表单重复提交
     * 
     * @param e
     * @return
     */
    @ResponseStatus(value = HttpStatus.OK)
    @ExceptionHandler(RepeatException.class)
    public Map<String, String> handleRepeatException(RepeatException e) {
        Map<String, String> errorMap = new HashMap<String, String>();
        errorMap.put("code", "99999");
        errorMap.put("msg", "表单重复提交");
        return errorMap;
    }

}
